//
//  PowerView.m
//  sensen_ios
//
//  Created by mc on 16/6/6.
//  Copyright © 2016年 pro. All rights reserved.
//

#import "PowerView.h"

@implementation PowerView{
    UILabel *titleLable;
    UILabel *valueLable;
    UIImageView *imageView;
}

- (id)initWithFrame:(CGRect)frame{//大小高60宽120
    self = [super initWithFrame:frame];
    if (self) {
        
        self.backgroundColor = [UIColor clearColor];
        titleLable = [[UILabel alloc] init];
        titleLable.frame = CGRectMake(0, 0, frame.size.width, frame.size.height * 0.5);
        titleLable.backgroundColor = [UIColor clearColor];
        titleLable.textAlignment = NSTextAlignmentCenter;
        titleLable.textColor = [UIColor whiteColor];
        titleLable.font = FONT(16);
        titleLable.text = @"灯光照明";
        [self addSubview:titleLable];
        
        imageView = [[UIImageView alloc] init];
        imageView.frame = CGRectMake(20, frame.size.height *0.75 - 2.5 , 5, 5);
        [self addSubview:imageView];
        imageView.image = [UIImage imageNamed:@"我家的鱼缸_013"];
        
        
        valueLable = [[UILabel alloc] init];
        valueLable.frame = CGRectMake(imageView.right + 5, titleLable.bottom, frame.size.width, frame.size.height * 0.5);
        valueLable.backgroundColor = [UIColor clearColor];
        valueLable.textAlignment = NSTextAlignmentLeft;
        valueLable.textColor = [UIColor whiteColor];
        valueLable.font = FONT(16);
        valueLable.text = @"0 W";
        [self addSubview:valueLable];
        
    }
    return self;
}


- (void)setType:(BOOL)type{
    imageView.image = [UIImage imageNamed:type ? @"我家的鱼缸_013" :@"我家的鱼缸_06"];
}

- (void)setTitle:(NSString *)title{
    titleLable.text = title;
}

- (void)setValue:(int)value{
    valueLable.text = [NSString stringWithFormat:@"%d W", value];
}


@end
